package com.BGR.controller;

import com.BGR.domain.User;
import com.BGR.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/test")
public class TestController {
    @Autowired
    private StringRedisTemplate redisTemplate;

    @Autowired
    private UserMapper userMapper;

    @GetMapping("/hello")
    @PreAuthorize("hasAuthority('system:dept:index')")
    public String test() {
        return "hello";
    }

    @GetMapping("/selectUser")
    public List<User> test01() {
        return userMapper.selectList(null);
    }

    @GetMapping("/selectUser/{id}")
    public User test02(@PathVariable("id") String id) {
        return userMapper.selectById(id);
    }


}
